package com.itany.nmms.util;

/**
 * Author:shixiaojun@itany.com
 * Date:2022/3/14 14:00
 * Version:1.0-SNAPSHOT
 */
public class ParameterUtil {

    public static boolean isNull(String s){
        return null == s || "".equals(s);
    }

    public static String nextSequence(String s){
        int i = Integer.parseInt(s) + 1;
        s = "00000"+i;
        return s.substring(s.length()-6);
    }

    /**
     * 用于模糊查询时escape语句
     * 为指定字符串的每一个字符前加一个/
     * 表示为普通字符串,在sql中没有任何特殊意义
     * @param s
     * @return
     */
    public static String escapeString(String s){
        if(!ParameterUtil.isNull(s)){
            char[] cs = s.toCharArray();
            StringBuffer buffer = new StringBuffer();
            for(char c : cs){
                buffer.append("/"+c);
            }
            return buffer.toString();
        }
        return null;
    }

}
